/*
 * Description: 处理稳定性事件上报
 */
#ifndef EVENT_REPORTER_H
#define EVENT_REPORTER_H

#include <thread>
#include "stability_common.h"
#include "singleton.h"
#include "rpc_service/sendto_host.h"

namespace DFX {
class EventReporter {
public:
    EventReporter() = default;
    ~EventReporter() = default;
    void Start();
    void Init(std::shared_ptr<WINCONTROL::SendToHost> sendtoHost);
    void Deinit();
    void Stop();
    void ReportEventData(const string &eventName, const map<string, string> &eventData);

private:
    void ReportEvent();
    std::shared_ptr<WINCONTROL::SendToHost> m_sendtoHost{ nullptr };
    std::mutex reportMtx;
    std::condition_variable reportCV;
    std::thread eventReportThread;
    bool stopReportFlag = false;
};
}

#define EVENT_REPORTER SingletonNew<DFX::EventReporter>::GetInstance()

#endif